public class TestForNum {
	public static void main(String[] args) {
		int n = 5532323;
		int sum = 0;
		for(;n>0;n/=10) {
			int t = n%10;
			if(t>=5) {
				sum+=t;
			}
		}
		System.out.println(sum);
	}
}